home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-GM / Interfaces&Libraries / Interfaces / AIncludes / IntEnv.a < prev    next >
Encoding:
Text File  |  1996-05-07  |  4.9 KB  |  141 lines  |  [TEXT/MPS ]

  1. ;  File IntEnv.a
  2. ;
  3. ;  Copyright Apple Computer, Inc. 1986 - 1996
  4. ;  All rights reserved.
  5. ;
  6. ;  Include File for Accessing the Integrated Environment Libraries
  7.  
  8. ;  Set CASE OBJECT to assure references to the names IMPORTed here link
  9. ;  properly.  The following statements restore the CASE setting to its
  10. ;  previous value.
  11.  
  12.     IF &TYPE('__INCLUDINGINTENV__') = 'UNDEFINED' THEN
  13. __INCLUDINGINTENV__    SET    1
  14.  
  15.     IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
  16.     include 'ConditionalMacros.a'
  17.     ENDIF
  18.  
  19.     IF GENERATING68K THEN
  20.  
  21.             PRINT            Push,Off            ; save current print settings and turn it off
  22.             GBLC            &S%%%,&P%%%
  23. &S%%%        SETC            &Setting('CASE')    ; save current CASE setting
  24. &P%%%        SETC            &Setting('PRINT',1) ; and PRINT settings before we changed them
  25.  
  26.             MACRO
  27.             X%%%
  28.             GBLC            &S%%%,&P%%%         ; link references with previously defined variables
  29.             PRINT            Push,&P%%%            ; restore the previous PRINT settings
  30.             CASE            &S%%%                ; and restore the CASE setting
  31.             PRINT            POP                 ; restore the PRINT settings
  32.             ENDM
  33.  
  34.             PRINT            Pop                 ; restore the PRINT settings
  35.             CASE            OBJECT                ; all imported/exported names case significant
  36.  
  37. ;  Integrated Environment Globals
  38.  
  39.             IMPORT            StandAlone            ; a long, 0 if in shell, 1 if standalone
  40.             IMPORT            errno                ; a long, error number; set on unsuccessful I/O calls
  41.             IMPORT            MacOSErr            ; a word;  set along with errno if appropriate
  42.  
  43.     IF (&TYPE('NURUNTIME') <> 'UNDEFINED') THEN
  44. _#StandAlone    DS.L        StandAlone
  45. _#errno            DS.L        errno
  46. _#MacOSErr        DS.L        MacOSErr
  47.     ENDIF
  48.  
  49. ;  Integrated Environment Routines
  50.  
  51.             IMPORT            _DataInit            ; called for you by _RTInit
  52.             IMPORT            _RTInit             ; your tool MUST call this routine on startup
  53.             IMPORT            _RTExit             ; Does NOT return
  54.             IMPORT            getenv
  55.             IMPORT            IEGETENV
  56.             IMPORT            atexit
  57.             IMPORT            exit
  58.             IMPORT            _exit
  59.             IMPORT            faccess
  60. ;  cmd values for faccess
  61. ;  F_OPEN        EQU         (('d'<<8)|$0)        ; for internal use only
  62. ; 'd' => "directory" ops; available for any program
  63. F_DELETE        EQU         (('d'<<8)|$1)        ; deletes filename
  64. F_RENAME        EQU         (('d'<<8)|$2)        ; renames file to string pointed to by arg
  65. ;  'e' => "editor" ops; available to programs running under MPW
  66. F_GTABINFO        EQU         (('e'<<8)|$0)        ; arg is address of long, has tab offset
  67. F_STABINFO        EQU         (('e'<<8)|$1)        ; arg is address of long, new tab offset
  68. F_GFONTINFO     EQU         (('e'<<8)|$2)        ; arg is address of long, has font info
  69. F_SFONTINFO     EQU         (('e'<<8)|$3)        ; arg is address of long, new font info
  70.                                                 ; high order-font number; low-font size
  71. F_GPRINTREC     EQU         (('e'<<8)|$4)        ; arg is handle to print record TPrint
  72. F_SPRINTREC     EQU         (('e'<<8)|$5)        ; arg sets handle to print record TPrint
  73. F_GSELINFO        EQU            (('e'<<8)|$6)        ; arg is address of selection record
  74. F_SSELINFO        EQU            (('e'<<8)|$7)        ; arg is address of selection record
  75. F_GWININFO        EQU            (('e'<<8)|$8)        ; arg is address of a rect
  76. F_SWININFO        EQU            (('e'<<8)|$9)        ; arg is address of a rect
  77. F_GSCROLLINFO    EQU            (('e'<<8)|$A)        ; get scroll information
  78. F_SSCROLLINFO    EQU            (('e'<<8)|$B)        ; set scroll information
  79.  
  80.             IMPORT            open
  81. ;  mode values for open call
  82. O_RDONLY        EQU         0
  83. O_WRONLY        EQU         1
  84. O_RDWR            EQU         2
  85.  
  86. ; auxiliary mode flags for open call  (one of above plus zero or more from this list)
  87. O_APPEND        EQU         (1<<3)            ; when writing, seek to EOF before each write
  88. O_RSRC            EQU         (1<<4)            ; open the resource fork
  89. O_ALIAS            EQU            (1<<5)            ; Open alias file
  90. O_CREAT         EQU         (1<<8)            ; create file if it doesn't exist
  91. O_TRUNC         EQU         (1<<9)            ; truncate file to zero size
  92. O_EXCL            EQU         (1<<10)         ; if O_CREAT is set, open will fail if file exists
  93. O_NRESOLVE        EQU            (1<<14)            ; Don't resolve any aliases
  94.  
  95. ;  predefined file descriptors for standard input, standard output, and diagnostic output
  96. InputFD         EQU         0
  97. OutputFD        EQU         1
  98. DiagnosticFD    EQU         2
  99.  
  100.             IMPORT            close
  101.             IMPORT            read
  102.             IMPORT            write
  103.             IMPORT            ioctl
  104.  
  105. ;  selector values for ioctl calls
  106. ;  FIOLSEEK     EQU         (('f'<<8)|00)    ; internal use only
  107. ;  FIODUPFD     EQU         (('f'<<8)|01)    ; internal use only
  108. FIOINTERACTIVE    EQU         (('f'<<8)|02)    ; returns 0 if interactive, -1 if not
  109. FIOBUFSIZE        EQU         (('f'<<8)|03)    ; Arg is address of long, returns the optimal
  110.                                             ; buffer size for this device
  111. FIOFNAME        EQU         (('f'<<8)|04)    ; Arg is address of filename associated with  fd
  112. FIOREFNUM        EQU         (('f'<<8)|05)    ; Arg is address of short, returns fd's refnum
  113. FIOSETEOF        EQU         (('f'<<8)|06)    ; Set file length to long in arg
  114. TIOFLUSH        EQU         (('t'<<8)|00)    ; throw away terminal input
  115.  
  116.             IMPORT            lseek
  117. ;  mode values for lseek
  118. fromStart        EQU         0
  119. fromCurPos        EQU         1
  120. fromEnd         EQU         2
  121.  
  122.             IMPORT            fcntl
  123. ;  argument to fcntl
  124. F_DUPFD         EQU         0
  125.  
  126.             IMPORT            TRAPAVAILABLE
  127.             IMPORT            MakeResolvedFSSpec
  128.             IMPORT            ResolveFolderAliases
  129.             IMPORT            ResolvePath
  130.             IMPORT            IERESOLVEPATH
  131.             IMPORT            MakeResolvedPath
  132.  
  133.             PRINT            Push,Off        ; save and turn off PRINT when macro is invoked
  134.             X%%%                            ; invoke the macro to restore CASE setting
  135.             PRINT            POP             ; restore the PRINT settings
  136.  
  137.     ELSE
  138.         aerror    'IntEnv.a is a 68K only assembly file!'
  139.     ENDIF    ; ...GENERATING68K
  140.     
  141.     ENDIF    ; ...already included